import { defineStore } from 'pinia';
import router from "@/route";
import { LoginResultVo } from '@/api/login/types';
import {message} from "ant-design-vue"
export const UserStore = defineStore('userConstructor', {
  state: () => ({
    UserInfo: {} as LoginResultVo,
  }),
  getters: {},
  actions: {
   async doLogin(param: LoginResultVo) {
      this.UserInfo = param;
      await sessionStorage.setItem('token',param.token)
      await sessionStorage.setItem('UserInformation',JSON.stringify(param))
      router.replace('/search')
      message.success('登录成功！')
    },
  },
});
